#include<iostream>
#include<cstdlib>
#include<vector>
#include "VerificationSim.h"
#include "Initialization.h"
using namespace std;

int initialization(Matrix A, Matrix B, Matrix C, int n){
	
	vector<double>p(n);
	vector<double>q(n);
	// we manually set the size of subset to be 3
	int p1;
	int p2;
	int p3; 

	//choose the three vectors in the subset of p
	do{
		p1 = rand() % n;
		p2 = rand() % n;
		p3 = rand() % n;
	}while ((p1 != p2) && (p1 != p3) && (p2 != p3)); 
	
	int q1;
	int q2;
	int q3;
	//choose the three vectors in the subset of p
	do{
		q1 = rand() % n;
		q2 = rand() % n;
		q3 = rand() % n;
	}while ((q1 != q2) && (q1 != q3) && (q2 != q3));

	//Initialize p and q
	for (int i = 0; i < n; i++){
		p[i] = (double)rand()/RAND_MAX;
		q[i] = (double)rand()/RAND_MAX;
	}
	
	//calculate vector aR, bS,cRS
	vector<double> aR(n);
	vector<double> bS(n);
	double cRS = 0;
	for (int j = 0; j < n; j++){
		aR[j] = A.contents[p1][j] * p[p1]
				+ A.contents[p2][j] * p[p2]
				+ A.contents[p3][j] * p[p3];
		bS[j] = B.contents[j][q1] * q[q1]
				+ A.contents[j][q2] * q[q2]
				+ A.contents[j][q3] * q[q3];

	}
	
	cRS = bS[p1] * p[p1] + bS[p2] * p[p2] + bS[p3] * p[p3];

}